<template>
	<view>

		<!-- 		<view class="noCommodity">
			<video class="noCommodity" :src="video_link" :autoplay="autoplay" :page-gesture="pageGesture" :show-mute-btn= "isShowMute" :object-fit="fjt"></video>
		</view> -->
		<view class="content">
			<smm-video :videoTitle= "videoTitle" :srcList="srcList" :isDanmu.sync="isdanmu" :isDanmuBtn="isdanmuBtn"
				:danmuList='danmuList'></smm-video>
		</view>
		<!-- #ifndef MP -->
		<home></home>
		<!-- #endif -->
	</view>
</template>

<script>
	import {
		getCollectUserList,
		getProductHot,
		collectDel
	} from '@/api/store.js';
	import {
		getCourseDetail
	} from '@/api/order';
	import {
		mapGetters
	} from "vuex";
	import {
		toLogin
	} from '@/libs/login.js';
	import recommend from '@/components/recommend';
	// #ifdef MP
	import authorize from '@/components/Authorize';
	// #endif
	import home from '@/components/home';
	import colors from '@/mixins/color.js';
	import {
		HTTP_REQUEST_URL
	} from '@/config/app';

	export default {
		components: {
			recommend,
			// #ifdef MP
			authorize,
			// #endif
			home
		},
		mixins: [colors],
		data() {
			return {
				id: 0, //商品ID
				autoplay: true,
				pageGesture: true, //在非全屏模式下，是否开启亮度与音量调节手势
				isShowMute: true, //是否显示静音按钮
				fjt: "fil", //当视频大小与 video 容器大小不一致时，视频的表现形式。contain：包含，fill：填充，cover：覆盖
				imgHost: HTTP_REQUEST_URL,
				videoTitle: "",

				classDetailInfos: {}, //课程详情
				srcList: [
					// {
					// 	src: 'https://scrm.100epoch.cn/uploads/video/2025/08/04/22222222.mp4',
					// 	name: '视频名',
					// 	// time: 314
					// },
				],
				isdanmu: false, //是否显示弹幕
				isdanmuBtn: false, //弹幕控制按钮
				danmuList: [
					// {
					// 	text: '没有弹幕？',
					// 	color: '#ffffff',
					// 	time: 1
					// },
				]
			};
		},
		computed: mapGetters(['isLogin']),
		onLoad(options) {
			let that = this;
			if (that.isLogin) {
				that.id = options.id;
				that.getClassDetail(that.id)
			} else {
				toLogin();
			}
		},
		onShow() {
			
		},
		methods: {
			getClassDetail(id) {
				getCourseDetail(id).then(res => {
					this.classDetailInfos = res.data;
					
					if (res.data.meterial_info.length > 0) {
						this.videoTitle = res.data.store_name
						this.srcList = res.data.meterial_info.map(item => ({
							src: item.video_link,
							name: item.title,
							poster: item.image_input
						}))
						// this.srcList.push(...this.srcList)
						// this.srcList.push(...this.srcList)
						// this.srcList.push(...this.srcList)
						// this.srcList.push(...this.srcList)
					} else {
						this.srcList = []
					}
				})
			},
			
		},
	}
</script>

<style scoped lang="scss">
	.content {
	    width: 100%;
	}
	
</style>